#include "RedBlackTree.h"
#include "AVLTree.h"
#include <vector>
int main()
{
	//RBTree<int, int> rbtree;
	////int arr[] = { 16, 3, 7, 11, 9, 26, 18, 14, 15 };
	//int arr[] = { 4, 2, 6, 1, 3, 5, 15, 7, 16, 14 };
	//for (auto e : arr)
	//{
	//	rbtree.Insert(make_pair(e, e));
	//	std::cout << "Insert: " << e << "->" << std::endl;
	//}

	/*const int N = 10000;
	vector<int> v;
	v.reserve(N);
	srand(time(0));
	for (size_t i = 0; i < N; i++)
	{
		v.push_back(rand());
	}
	RBTree<int, int> rbtree;
	for (auto e : v)
	{
		rbtree.Insert(make_pair(e, e));
		std::cout << "Insert: " << e << "->" << rbtree.IsBalance() << std::endl;
	}*/

	const int N = 10000000;
	vector<int> v;
	v.reserve(N);
	srand(time(0));
	for (size_t i = 0; i < N; i++)
	{
		v.push_back(rand()+i);
	}
	RBTree<int, int> rbtree;
	AVLTree<int, int> avltree;
	for (auto e : v)
	{
		rbtree.Insert(make_pair(e, e));
	}
	cout << "rbtree.IsBalance(): " << rbtree.IsBalance() << endl;
	cout << "rbtree.Height(): " << rbtree.Height() << endl;
	cout << "rotateCount: " << rbtree.rotateCount << endl;

	for (auto e : v)
	{
		avltree.Insert(make_pair(e, e));
	}
	cout << "avltree.IsBalance(): " << avltree.IsBalance() << endl;
	cout << "avltree.Height(): " << avltree.Height() << endl;
	cout << "rotateCount: " << rbtree.rotateCount << endl;
	return 0;
}